package com.example.shopping.repository;

import com.example.shopping.entity.GoodsType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

public interface GoodsTypeRepository  extends JpaRepository<GoodsType,String> {
    public List<GoodsType> findByTcode(String tcode);

    Object findTop1ByTcodeLike(String tcode);


    @Query("SELECT NEW map(g.tcode as tcode, g.tname as tname) FROM GoodsType g")
    List<Map<String, String>> findAllGoodsTypeAsMap();


}
